package com.assignwork.modules.workarrange;

import com.assignwork.dto.ShipForecastSearchDTO;
import com.assignwork.dto.WorkArrangeOtherSearchDTO;
import com.assignwork.dto.WorkArrangeOtherSubmitDTO;
import com.assignwork.service.IWorkArrangeOtherService;
import com.assignwork.vo.WorkArrangeOtherPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName WorkArrangeOtherController
 * @Description 其他配工作业前端控制器
 * @Author dujianyu
 * @Date 2023/12/11 11:10
 */
@RestController
@AllArgsConstructor
@RequestMapping("workArrange/other")
public class WorkArrangeOtherController extends BladeController {

    private IWorkArrangeOtherService service;

    @PostMapping("submit")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "新增或修改", notes = "传入dto")
    public R<Boolean> submitWAOther(@RequestBody WorkArrangeOtherSubmitDTO dto) {
        return R.status(service.submitWaOther(dto));
    }

    @GetMapping("/page")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "分页", notes = "传入dto")
    public R<IPage<WorkArrangeOtherPageVO>> waOtherPage(WorkArrangeOtherSearchDTO dto, Query query) {
        return R.data(service.selectWaOtherPage(dto, Condition.getPage(query)));
    }

    @PostMapping("/remove")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "删除", notes = "传入id")
    public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String id) {
        return R.status(service.removeWaOther(Func.toLong(id)));
    }

}
